package com.onefinger.manager.mocks
{
	import com.onefinger.manager.vos.Waiter;
	
	import mx.collections.ArrayCollection;

	public class WaiterMockService
	{
		private var _list:ArrayCollection = new ArrayCollection();
		
		public function WaiterMockService()
		{
			/*var wineCategory:Category = new Category();
			wineCategory.id = 1;
			wineCategory.name = "Vinos";
			wineCategory.showOrder = 1;
			wineCategory.icon = "wines.jpg";
			_list.addItem( wineCategory );*/
		}
		
		
		public function list():ArrayCollection
		{
			return _list;
		}
		
		public function save( device:Waiter ):Boolean
		{
			var index:int = _list.getItemIndex( device );
			if( index != -1 )
			{
				return true;
			} else {
				_list.addItem(device);
				return true;
			}
		}
		public function update( device:Waiter ):Boolean
		{
			var index:int = _list.getItemIndex( device );
			if( index != -1 )
			{
				_list.list.itemUpdated(device);
				return true;
			} else {
				
				return true;
			}
		}
		public function remove( device:Waiter ):Boolean
		{
			var index:int = _list.getItemIndex( device );
			if( index == -1 )
			{
				return false;
			} else {
				_list.removeItemAt( index );
				return true;
			}
		}
		
	}
}